package one.to.one.cas1;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

//@Entity
public class Personne implements Serializable {

	private static final long serialVersionUID = 978532622628890425L;

	@Id
	 @Column(nullable = false, unique = true)
//	@Column
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@Column(nullable = false)
	@Version
	private int version;

	@Column(length = 30, nullable = false, unique = true)
	private String nom;

	@Column(length = 30, nullable = false)
	private String prenom;

	@Column(nullable = false)
	@Temporal(TemporalType.DATE)
	private Date datenaissance;

	@Column(nullable = false)
	private boolean marie;

	@Column(nullable = false)
	private int nbenfants;

	@Embedded
	private Adresse adresse;

	public Personne() {
	}

	public Personne(int version, String nom, String prenom, Date datenaissance,
			boolean marie, int nbenfants, Adresse adresse) {
		this.version = version;
		this.nom = nom;
		this.prenom = prenom;
		this.datenaissance = datenaissance;
		this.marie = marie;
		this.nbenfants = nbenfants;
		this.adresse = adresse;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public String getPrenom() {
		return prenom;
	}

	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

	public Date getDatenaissance() {
		return datenaissance;
	}

	public void setDatenaissance(Date datenaissance) {
		this.datenaissance = datenaissance;
	}

	public boolean isMarie() {
		return marie;
	}

	public void setMarie(boolean marie) {
		this.marie = marie;
	}

	public int getNbenfants() {
		return nbenfants;
	}

	public void setNbenfants(int nbenfants) {
		this.nbenfants = nbenfants;
	}

	public Adresse getAdresse() {
		return adresse;
	}

	public void setAdresse(Adresse adresse) {
		this.adresse = adresse;
	}
}
